var regeneratorRuntime = require("../../lib/js/runtime-module.js")
import Serv from './activeListServ';
import formatDate from '../../utils/util2.js'

Component({
  /**
   * 页面的初始数据
   */
  properties: {
    coupon: {
      type: Object,
      value: 'default value'
    },
    couponType: { //优惠券样式类型
      type: String,
      value: 'myCoupon'
    },
    passParams: String
  },
  data: {
   
  },
  ready: function() {
    wx.setNavigationBarTitle({
      title: '优惠活动'
     })
    this.getHouseActivity('1057841539127611392');
  },
  /**
   * 组件的方法列表
   */
  methods: {
  //获取楼盘活动
  getHouseActivity: async function (id) {
    let params = {
      businessId: id
    }
    let {
      rows,
      success,
      msg
    } = await Serv.queryHouseActivity(params)
    let activityList = rows && rows.filter((item, idx) => {
      return item.endDate && formatDate.contrastDate(item.endDate)
    })
    activityList&&activityList.sort((item, idx) => { return !item.isSelfTemplate});
   
    if (success) {
      this.setData({
        activityList,
      })
    }
  }
  }
})